using System.Collections;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Voodoo.Pattern;

public class DuelModeFindPlayer : MonoBehaviour
{
	public TextMeshProUGUI OpponentName;

	public Image OpponentFlag;

	private void OnEnable()
	{
		StartCoroutine(ChoseName());
	}

	private IEnumerator ChoseName()
	{
		SingletonMB<DuelModeManager>.Instance.ChoseFlag();
		OpponentFlag.sprite = SingletonMB<DuelModeManager>.Instance._opponentSprite;
		SingletonMB<DuelModeManager>.Instance.OpponentName = SingletonMB<GameManager>.Instance.namePool.GetRandomString();
		OpponentName.text = SingletonMB<DuelModeManager>.Instance.OpponentName;
		yield return new WaitForSeconds(0.1f);
		SingletonMB<DuelModeManager>.Instance.ChoseFlag();
		OpponentFlag.sprite = SingletonMB<DuelModeManager>.Instance._opponentSprite;
		SingletonMB<DuelModeManager>.Instance.OpponentName = SingletonMB<GameManager>.Instance.namePool.GetRandomString();
		OpponentName.text = SingletonMB<DuelModeManager>.Instance.OpponentName;
		yield return new WaitForSeconds(0.2f);
		SingletonMB<DuelModeManager>.Instance.ChoseFlag();
		OpponentFlag.sprite = SingletonMB<DuelModeManager>.Instance._opponentSprite;
		SingletonMB<DuelModeManager>.Instance.OpponentName = SingletonMB<GameManager>.Instance.namePool.GetRandomString();
		OpponentName.text = SingletonMB<DuelModeManager>.Instance.OpponentName;
		yield return new WaitForSeconds(0.3f);
		SingletonMB<DuelModeManager>.Instance.ChoseFlag();
		OpponentFlag.sprite = SingletonMB<DuelModeManager>.Instance._opponentSprite;
		SingletonMB<DuelModeManager>.Instance.OpponentName = SingletonMB<GameManager>.Instance.namePool.GetRandomString();
		OpponentName.text = SingletonMB<DuelModeManager>.Instance.OpponentName;
		yield return new WaitForSeconds(0.4f);
		SingletonMB<DuelModeManager>.Instance.ChoseFlag();
		OpponentFlag.sprite = SingletonMB<DuelModeManager>.Instance._opponentSprite;
		SingletonMB<DuelModeManager>.Instance.OpponentName = SingletonMB<GameManager>.Instance.namePool.GetRandomString();
		OpponentName.text = SingletonMB<DuelModeManager>.Instance.OpponentName;
		SingletonMB<DuelModeManager>.Instance.NameUpdated();
	}
}
